<!--
 * @Author: 橘子
 * @Date: 2022-11-26 09:33:29
 * @Project_description: demo
 * @Description: 代码是我抄的，不会也是真的
-->
<template>
  <div>
    <el-card body-style='{height: 20px;}' class='box-card' shadow='always'>
      <div slot='header' class='clearfix'>
        <span>个人中心</span>
        <el-button style='float: right; padding: 3px 0' type='text' @click='eidt'>修改</el-button>
      </div>
      <el-descriptions :column='1' border>
        <el-descriptions-item label='头像'>
          <y-image v-model='user.avatarImg' />
        </el-descriptions-item>
        <!-- <el-descriptions-item label="性别">{{ user.gender | _gender }}</el-descriptions-item> -->
        <el-descriptions-item label='姓名'>{{ user.userName }}</el-descriptions-item>
        <el-descriptions-item label='userId'>
          <el-link :underline='false' type='primary' @click='_copy(user.userId)'>{{ user.userId }}</el-link>
        </el-descriptions-item>
        <el-descriptions-item label='账号'>
          <el-link :underline='false' type='primary' @click='_copy(user.accountNumber)'>{{ user.accountNumber }}
          </el-link>
        </el-descriptions-item>
        <el-descriptions-item label='手机号'>
          <el-link :underline='false' type='primary' @click='_copy(user.phone)'>{{ user.phone }}</el-link>
        </el-descriptions-item>
        <el-descriptions-item label='身份证'>
          <el-link :underline='false' type='primary' @click='_copy(user.idCard)'>{{ user.idCard }}</el-link>
        </el-descriptions-item>
        <!--        <el-descriptions-item label='权限'>{{ user.power }}</el-descriptions-item>-->
        <!--        <el-descriptions-item label='创建时间'>{{ user.createTime }}</el-descriptions-item>-->
        <el-descriptions-item label='备注'>
          <el-popover :content='user.remarks' placement='top-start' title='备注' trigger='hover' width='200'>
            <span slot='reference' class='base-s'>{{ user.remarks }}</span>
          </el-popover>
        </el-descriptions-item>
      </el-descriptions>
    </el-card>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  name: 'userInfo',
  data() {
    // 这里存放数据
    return {
      user: {},
    }
  },
  computed: {
    ...mapState('d2admin/user', [
      'isEdit',
    ]),
  },
  watch: {
    isEdit(o) {
      this.user = this.$db._getUser()
    },
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {
    this.user = this.$db._getUser()
  },
  // 方法集合
  methods: {
    eidt() {
      this.$emit('update')
    },
  },
}
</script>

<style lang='scss' scoped>
//@import url(); 引入公共css类
</style>
